home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-07-15 | 6.4 KB | 136 lines | [TEXT/MPS ] |
- //----------------------------------------------------------------------------------------
- // UTwistDownElement.h
- // ETO20 MacApp 3.3.1, MPW 3.4.1
- // Copyright ©1995-1996 Conrad Kopala
- // Twist Down Lists version 2.0a0 7/15/96
- //----------------------------------------------------------------------------------------
-
- #ifndef __UTWISTDOWNELEMENT__
- #define __UTWISTDOWNELEMENT__
-
- //MacApp stuff
- #ifndef __UOBJECT__
- #include "UObject.h"
- #endif
-
- //ToolBox stuff
- //None
-
- //ANSI stuff
- //None
-
- //----------------------------------------------------------------------------------------
- // Constants
- //----------------------------------------------------------------------------------------
-
- //----------------------------------------------------------------------------------------
- // Externals
- //----------------------------------------------------------------------------------------
- class TTwistDownControl; //external
- class TTwistDownDocument; //external
- //----------------------------------------------------------------------------------------
- // TTwistDownElement
- //----------------------------------------------------------------------------------------
-
- class TTwistDownElement: public TObject, public MScriptableObject
- {
- MA_DECLARE_CLASS;
-
- public:
- TTwistDownDocument* fTwistDownDocument; //Needed for GetObjectsContainer()
- TTwistDownElement* fSuccessorElement; //A NULL value terminates this portion of the chain.
- TTwistDownElement* fDescendantElement; //For files, fDescendantElement is always NULL. For empty folders,
- //fDescendantElement == NULL otherwise, fDescendantElement != NULL.
-
- long fItemInList; //This identifies the position of the element in the list.
- //The position in the list is established in
- //TTwistDownDocument::MakeTwistDownElement. After that
- //it never changes. Note that its position in the list
- //differs from its rowNumber in TTwistDownView as only
- //a portion of the list is displayed unless the list
- //has been completely expanded. Originally used only for
- //finding your mistakes (debugging, for those who don't
- //make mistakes.)
-
-
- short fIndentLevel; //This is establised in TTwistDownDocument::MakeTwistDownElement.
- //After that, it never changes.
-
- Boolean fHasSubList; //This is set in TTwistDownDocument::BuildTwistDownList.
- //Once set, it is never cleared. If fHasSubList == TRUE,
- //fDescendantElement will not be NULL unless the folder is empty.
- //It might more appropriately be called fIsFolder.
-
- Boolean fShowSubList; //Set and cleared as required but only if fHasSubList == TRUE.
- //If fHasSubList == FALSE, fShowSubList is never set and never
- //cleared. If fShowSubList == TRUE, the twistDownTriangle points
- //down and the descendant elements beginning with fDescendantElement
- //are shown. In the case of an empty folder, fShowSubList can be
- //TRUE with the twistDownTriangle pointing down to show that
- //there is nothing in it. It might more appropriately be called
- //fShowFolderContents.
-
- Boolean fOldShowSubList; //This is here to support error recovery in out of memory situations.
- //When expanding the whole list, and the out of memory condition is
- //encountered, we need to recover. This is done by 'un-expanding'
- //the list. To successfully accomplish that, it is necessary to
- //remember the value of the fShowSubList flag so that it can be
- //restored to its old value. The old value is kept in fOldShowSubList.
-
- CStr63 fDisplayedText; //The name of the folder or file as the case may be.
-
- TTwistDownControl* fTwistDownControl; //Its twistDownControl, if any. Only those twistDownElements
- //for which fHasSubList == TRUE can ever have a
- //twistDownControl.
-
- TTwistDownElement::TTwistDownElement();
- virtual ~TTwistDownElement();
-
- void TTwistDownElement::ITwistDownElement(TTwistDownDocument* twistDownDocument, short indentLevel,
- CStr63 displayedText);
-
- void TTwistDownElement::GetDisplayedText(CStr63& theDisplayedText);
-
- void TTwistDownElement::SetHasSubListFlag();
- void TTwistDownElement::ClearHasSubListFlag(); //Is never used. Included for completeness.
- Boolean TTwistDownElement::TestHasSubListFlag();
-
- void TTwistDownElement::SetShowSubListFlag();
- void TTwistDownElement::ClearShowSubListFlag();
- void TTwistDownElement::RestoreShowSubListFlag();
- Boolean TTwistDownElement::TestShowSubListFlag();
-
- void TTwistDownElement::SetOldShowSubListFlag();
- void TTwistDownElement::ClearOldShowSubListFlag();
- Boolean TTwistDownElement::TestOldShowSubListFlag();
-
- void TTwistDownElement::SetSuccessorElementTo(TTwistDownElement* theSuccessorElement);
- void TTwistDownElement::SetDescendantElementTo(TTwistDownElement* theDescendantElement);
- TTwistDownElement* TTwistDownElement::GetSuccessorElement();
- TTwistDownElement* TTwistDownElement::GetDescendantElement();
-
- void TTwistDownElement::SetTwistDownControlTo(TTwistDownControl* theTwistDownControl);
- TTwistDownControl* TTwistDownElement::GetTwistDownControl();
-
- void TTwistDownElement::SetIndentLevel(short indentLevel); //is not being used, included for completeness.
- short TTwistDownElement::GetIndentLevel();
-
- void TTwistDownElement::SetItemInList(long itemInList);
- long TTwistDownElement::GetItemInList();
-
- Boolean TTwistDownElement::CouldExpandElement(); //Tests to make sure the capacity of TTwistDownView
- //(TTextListView) will not be exceeded by an attempt
- //to expand the element.
-
- // Scripting support
- virtual void TTwistDownElement::DoScriptCommand(CommandNumber aCommandNumber, TAppleEvent* message,
- TAppleEvent* reply);
-
- virtual DescType TTwistDownElement::GetSpecifierForm();
- virtual Boolean TTwistDownElement::GetObjectProperty(CAEDesc& thePropertyValue,DescType whichProperty,
- const CAEDesc& desiredType);
-
- virtual MScriptableObject* TTwistDownElement::GetObjectsContainer();
-
- };
- #endif